package com.ousi.wx.service.Impl;

import cn.hutool.core.map.MapUtil;
import com.ousi.wx.dao.LotusVarietiesDao;
import com.ousi.wx.service.LotusVarietiesService;
import com.ousi.wx.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

@Service
public class LotusVarietiesServiceImpl implements LotusVarietiesService {

    @Autowired
    private LotusVarietiesDao lotusVarietiesDao;

    @Override
    public PageUtils selectAll(Map param) {
        ArrayList<HashMap> list = null;
        long count = lotusVarietiesDao.selectCount();
        if (count != 0) {
            list = lotusVarietiesDao.selectAll(param);
        }else {
            list = new ArrayList<>();
        }
        int page = MapUtil.getInt(param, "page");
        Integer length = MapUtil.getInt(param, "length");
        PageUtils pageUtils = new PageUtils(list, count, page, length);
        return pageUtils;
    }
}
